package nodes;


import compiler.Compiler;
import compiler.SymbolTable;
import compiler.Yytoken;

import descriptors.AbstractDescr;
import descriptors.ConstDescr;

public class IntegerNode extends ExpressionNode {

	private int value;
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	public IntegerNode(Yytoken token){
		super(token.line(),token.column());
		value=Integer.parseInt(token.value());
	}
	
	@Override
	public AbstractDescr compile(
			SymbolTable symbolTable, Compiler compiler) {
		return new ConstDescr(compiler.level(),value);
	}

	@Override
	public void print() {
		trace("IntegerNode: "+value);
		unindent();
	}

}
